<%--
  Created by IntelliJ IDEA.
  User: zzz
  Date: 2023/1/3
  Time: 10:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="../static/bootstrap-5.1.3-dist/css/bootstrap.css">
    <script type="text/javascript" src="../static/bootstrap-5.1.3-dist/js/bootstrap.js"></script>
    <title>宠物管理</title>
</head>
<body>
<style>
    body {
        margin: auto;
        width: 100%;
    }

    .card {
        width: 2000px;
        height: 700px;
        background-color: #fffdfd;
        margin-left: 120px;
        margin-top: 30px;
        border-radius: 30px;
        border: none;
        box-shadow: 5px 5px 10px #adabab;
    }

    .operate {
        padding: 20px 40px;
    }

    .operate button {
        border: solid;
        width: 150px;
    }

    table {
        text-align: center;
        vertical-align: middle !important;
        word-wrap:break-all;
        word-break:break-all;
        table-layout:fixed;
    }

    table .caozuo a{
        margin: 0 15px;
        width: 100px;
    }
    .page {
        height: 50px;
        width: 1270px;
        position: fixed;
        bottom: 100px;
    }

    li {
        list-style: none;
    }
</style>

<jsp:include page="../static/Page/Admin/User/head.jsp"/>
<div class="container text-center">
    <div class="row">
        <div class="">
            <jsp:include page="../static/Page/common/AdminNav.jsp"/>
        </div>
        <div class="card">
            <div class="tab-pane fade show active" id="v-pills-home" role="tabpanel" aria-labelledby="v-pills-home-tab"
                 tabindex="0"></div>
            <form method="post" action="pet_select" class="operate">
                <div class="row">
                    <div class="col-md-5">
                        <input type="text" class="form-control" placeholder="请输入宠物姓名" name="petname" value="${petname}">
                    </div>
                    <div class="col-md-1" style="margin-right: 200px">
                        <button type="submit" class="btn btn-outline-secondary">搜 索</button>
                    </div>
                </div>

            </form>
            <table id="pet" class="table table-bordered table-striped">
                <colgroup>
                    <col style="width:10%;">
                    <col style="width:10%;">
                    <col style="width:10%;">
                </colgroup>
                <thead>
                <tr>
                    <th>宠物姓名</th>
                    <th>类型</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${petList}" var="pet" varStatus="s">
                    <tr>
                        <td>${pet.name}</td>
                        <td>${pet.kind}</td>
                        <td class="caozuo">
                            <a href="pet_show?petid=${pet.id}" type="button" class="btn btn-outline-success">查 看</a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>

            <div class="page">
                <nav aria-label="Page navigation example">
                    <ul class="pagination justify-content-between">
                        <c:if test="${pageInfo.isLast && falg == null}">
                            <li><a href="pet_list?page=${pageInfo.pageIndex-1}" class="page-link"><span
                                    aria-hidden="true">&larr;</span> 上一页</a></li>
                        </c:if>
                        <c:if test="${pageInfo.isNext && falg == null}">
                            <li><a href="pet_list?page=${pageInfo.pageIndex+1}" class="page-link">下一页 <span
                                    aria-hidden="true">&rarr;</span></a></li>
                        </c:if>
                        <c:if test="${pageInfo.isLast && falg == 1}">
                            <li>
                                <a href="pet_select?page=${pageInfo.pageIndex-1}&petname=${petname}"
                                   class="page-link"><span aria-hidden="true">&larr;</span> 上一页</a></li>
                        </c:if>
                        <c:if test="${pageInfo.isNext && falg == 1}">
                            <li>
                                <a href="pet_select?page=${pageInfo.pageIndex+1}&petname=${petname}"
                                   class="page-link">下一页 <span aria-hidden="true">&rarr;</span></a></li>
                        </c:if>

                    </ul>
                    <span>第 ${pageInfo.pageIndex} 页/共 ${pageInfo.sumCount} 页</span>
                </nav>
            </div>
        </div>
    </div>
</div>
</body>
</html>
